'use client';

import { Button, Result } from 'antd';
import { useEffect } from 'react';

export default function Error({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  useEffect(() => {
    console.error(error);
  }, [error]);

  return (
    <Result
      status="error"
      title="出错了"
      subTitle={error.message || "页面加载失败，请重试"}
      extra={[
        <Button type="primary" key="retry" onClick={reset}>
          重试
        </Button>,
      ]}
    />
  );
} 